package com.guli.common.pojo.vo;
/*
 * @Author 罗
 * @date 2020/9/19 - 9:30 下午
 */

/**
 * 10. 通用异常
 */
public enum StatusCodeEnum {

    SUCCESS(0, "成功"),

    UNKNOW_EXCEPTION(10000, "系统未知异常"),

    GULI_MALL_EXCEPTION(10002, "出现谷粒商城运行时异常"),

    GLOBAL_EXCEPTION(10003, "捕获到全局异常"),

    VALID_EXCEPTION(10001, "JSR 303 数据校验异常"),

    STATUS_CODE_DOES_NOT_EXIST(10004, "微服务返回的结果中不包含状态码"),

    REDIRECT_TO_URL(10005,"重定向到新url附带跳回最终地址"),

    /**
     * elastic search 相关
     * */

    ELASTIC_SEARCH_UP_EXCEPTION(20003, "elastic search 上传异常"),

    INKOVE_SERVICE_EXCEPTION(20004, "调用微服务异常"),

    FREQUENTLY_SEND_VERIFICATION_CODE(30005, "过于频繁的发送验证码"),

    EXPIRE_VERIFICATION_CODE(30006, "验证码已过期"),

    /**
     * 40：会员服务相关异常
     */
    USERNAME_ALREADY_EXIST(40001, "用户名已经存在"),

    PHONE_NUMBER_ALREADY_REGISTERED(40002, "该手机已经被注册"),

    USERNAME_DOES_NOT_EXIST(40003, "用户名不存在"),

    PASSWORD_NOT_CORRECT(40004, "密码不正确"),

    USERNAME_OR_PASSWORD_NOT_CORRECT(40005, "用户名或密码不正确"),

    WEI_BO_LOGIN_EXCEPTION(40006, "微博登陆异常"),


    /**
     * 50:商品相关异常
     * */
    SKU_DOES_NOT_EXIST(5001,"sku不存在"),

    /**
     * 60:购物车相关
     * */
    CART_HAVE_NOT_SKU(60001,"用户购物车中没有对应的skuID"),

    /**
     * 70:订单相关
     * */
    TOKEN_INVALID(70001,"提交订单时，令牌失效"),

    TOTAL_AMOUNT_NOT_EQUALS(70002,"前端提交的总价（商品总价+运费）不等于后端最终计算的价格"),

    /**
     * 80: 库存相关
     * */
    THERE_IS_NOT_STOCK_FOR_SKU_ID(8001,"该sku没有对应的库存"),

    DEDUCT_STOCK_FAIL(80002,"扣减库存失败"),

    PARSE_ALIPAY_DATE_STRING_FAILED(80003,"解析阿里支付宝支付成功回调的日期参数失败"),

    ALI_PAY_PAYMENT_FAILED(80004,"支付宝支付失败"),

    OTHERS_SEND_A_FAKE_MESSAGE(80005,"他人伪造一条支付宝官方发送的消息来攻击本服务"),

    CLOSE_ALI_PAY_FAILED(80006,"关闭支付宝订单失败"),

    /**
     * 优惠卷服务相关
     * */
    REFRESH_SEC_KILL_SPU_FAILED(90001,"刷新秒杀商品缓存失败"),


    /**
     * 秒杀服务相关
     * */
    SEC_KILL_NOT_START_YET_OR_HAS_BEEN_TERMINATED(100001,"秒杀活动尚未开始或者活动已经结束"),

    SEC_KILL_SPU_ID_NOT_MATCH_RANDOM_CODE(100002,"提交的秒杀 spuId  skuId 和 randomCode 不匹配"),

    SEC_KILL_PURCHASE_QUANTITY_EXCEEDS_LIMIT(100003,"用户购买的数量超过单次秒杀数量的购买限制"),

    SEC_KILL_PURCHASE_MULTIPLE_EXCEEDS_LIMIT(100005,"用户之前购买过的数量加上本次购买的数量超出本次抢购的数量限制"),

    SEC_KILL_GET_SEMAPHORE_FAILED(100006,"商品已经被抢光啦！！（获取信号量失败，抢购失败，请重新再试）"),

    SENT_ORDER_INFO_TO_MESSAGE_QUEUE_FAILED(100007,"发送下订单的消息到消息队列失败"),



    /**
     * sentinel 相关
     * */
    SENTINEL_TO_MANY_REQUESTS(110001,"sentinel:请求太多，处理不过来"),
    ;

    private Integer code;

    private String msg;

    StatusCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return code + ":" + msg;
    }
}
